﻿using Common.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Utilities;

namespace TestXml
{
    class Program
    {
        static void Main(string[] args)
        {


            //var str =   XMLProcess.Read(@".\log4net.cfg.xml", "/log4net/appender", "name");
            //Console.WriteLine(str);
            //var xml = new XMLProcess(@".\log4net.cfg.xml");
            //xml.ReadAllChild("/log4net/appender");//查询子节点

            // xml.GetDataSetByXml(@".\log4net.cfg.xml");

           // XMLProcess.Insert(@".\log4net.cfg.xml", "/log4net/appender", "test", "name", "my"); //插入node数据
           // XMLProcess.Update(@".\log4net.cfg.xml", "/log4net/appender/test", "name", "mmm"); //修改node属性值

           // XMLProcess.Delete(@".\log4net.cfg.xml", "/log4net/appender/test");


            
            List<XmlDemo> xmlDemos = new List<XmlDemo>();
            XmlDemo demo = new XmlDemo() { Name = "ss", Code = "test", Struo = "ccc" };
            XmlDemo demo1 = new XmlDemo() { Name = "ss1", Code = "test1", Struo = "ccc1" };
            xmlDemos.Add(demo);
            xmlDemos.Add(demo1);
            //对象写入xml
            //SerializeHelper.Save(xmlDemos, @".\xx.xml");

            var ss = new SerializeHelper();
            var str1 = ss.ToXml<List<XmlDemo>>(xmlDemos); //xml序列化

            var list = ss.FromXml<List<XmlDemo>>(str1); //xml反序列化


          //  Console.WriteLine(str1);
            Console.Read();
        }
    }
}
